package cn.tedu.mapper.stock.stockadmin;

import cn.tedu.pojo.dto.order.OrderTebleDTO;
import cn.tedu.pojo.entity.OrderTeble;
import cn.tedu.pojo.pet.entity.PetDetails;
import cn.tedu.pojo.stock.entity.StockAdmin;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;

@Repository
public interface StockMapper {
    //向管理员库存管理表种添加数据//
    int addInStock(StockAdmin stockAdmin);
    //通过传入的stock的数量来修改商品内库存//
    void updateStockToCommodity(@Param("stock") Long newStockNum,
                                @Param("gmtModified") LocalDateTime gmtModified,
                                @Param("commodityId")Long commodityId);

    //从商品详情中根据商品id获取库存剩余//
    PetDetails getStockByCommodityId(Long commodityId);
    //从订单DTO接收数据，进行指定商品id的库存更改//
    void updateStockFromOrder(@Param("commodityId")Long commodityId,@Param("stock")Integer stock);


}
